let express = require('express');
let http = require('http');
const { createProxyMiddleware } = require('http-proxy-middleware');

let app = express();

app.use(express.static(__dirname));

app.use('/pc', createProxyMiddleware({
    target: 'http://hotel.admin.lanccn.com/api',
    pathRewrite:{
        "^/api": "",
    },
    changeOrigin: true
}))

app.use('/api', createProxyMiddleware({
    target: 'http://hotel.pc.lanccn.com/',
    pathRewrite:{
        "^/api": "",
    },
    changeOrigin: true
}))

app.use('/images_serv', createProxyMiddleware({
    target: 'http://hotel.pc.lanccn.com/images_serv',
    pathRewrite:{
        "^/images_serv": "",
    },
    changeOrigin: true
}))

let server = http.createServer(app);
server.listen(3000, '127.0.0.1');